<?php
$redis = new Redis();
try {
    $redis->connect('127.0.0.1', 6379, 1);
} catch (RedisException $e) {
    die($e->getMessage());
}

$redis->auth('123456');
echo '<pre>';
// 获取Redis服务器的版本信息
$versionInfo = $redis->info()['redis_version'];
print_r($versionInfo);
echo "Redis服务器的版本信息：" . $versionInfo;

//echo $redis->ping();
echo $redis->get('name');
echo '<br>';
$redis->set('addr', '河南郑州');
echo $redis->get('addr');
$redis->close();